﻿using System;
using System.Collections.Generic;

// ReSharper disable once CheckNamespace
namespace SD.OpcServer
{
    /// <summary>
    /// 数据类型
    /// </summary>
    public static class Constants
    {
        /// <summary>
        /// OPC代理服务器Id
        /// </summary>
        public static readonly Guid OpcProxyServerId = new Guid("8829C633-B6B7-4465-A8F8-A850BC263D8A");

        /// <summary>
        /// OPC服务器配置路径
        /// </summary>
        public const string OpcServerConfigPath = "App.Server.config";

        /// <summary>
        /// OPC服务器中断信号
        /// </summary>
        public const string Nil = "Nil";

        /// <summary>
        /// 可用数据类型
        /// </summary>
        public static readonly IDictionary<string, string> AvailableTypes = new Dictionary<string, string>
        {
            {Boolean, "布尔类型"},
            {Float, "单精度浮点类型"},
            {Double, "双精度浮点类型"},
            {Byte, "字节类型"},
            {Short, "短整数类型"},
            {Integer, "整数类型"},
            {Long, "长整数类型"},
            {String, "字符串类型"},
            {DateTime, "时间类型"}
        };

        /// <summary>
        /// 数据类型默认值
        /// </summary>
        public static readonly IDictionary<string, object> TypeDefaultValues = new Dictionary<string, object>
        {
            {Boolean, false},
            {Float, 0f},
            {Double, 0d},
            {Byte, 0},
            {Short, 0},
            {Integer, 0},
            {Long, 0},
            {String, string.Empty},
            {DateTime, System.DateTime.Now}
        };

        /// <summary>
        /// 数值类型
        /// </summary>
        public static readonly IDictionary<string, string> NumericTypes = new Dictionary<string, string>
        {
            {Float, "单精度浮点类型"},
            {Double, "双精度浮点类型"},
            {Byte, "字节类型"},
            {Short, "短整数类型"},
            {Integer, "整数类型"},
            {Long, "长整数类型"}
        };

        /// <summary>
        /// 整数类型
        /// </summary>
        public static readonly IDictionary<string, string> IntegerTypes = new Dictionary<string, string>
        {
            {Short, "短整数类型"},
            {Integer, "整数类型"},
            {Long, "长整数类型"}
        };

        /// <summary>
        /// 布尔类型
        /// </summary>
        public const string Boolean = "System.Boolean";

        /// <summary>
        /// 单精度浮点类型
        /// </summary>
        public const string Float = "System.Single";

        /// <summary>
        /// 双精度浮点类型
        /// </summary>
        public const string Double = "System.Double";

        /// <summary>
        /// 字节类型
        /// </summary>
        public const string Byte = "System.Byte";

        /// <summary>
        /// 短整数类型
        /// </summary>
        public const string Short = "System.Int16";

        /// <summary>
        /// 整数类型
        /// </summary>
        public const string Integer = "System.Int32";

        /// <summary>
        /// 长整数类型
        /// </summary>
        public const string Long = "System.Int64";

        /// <summary>
        /// 字符串类型
        /// </summary>
        public const string String = "System.String";

        /// <summary>
        /// 时间类型
        /// </summary>
        public const string DateTime = "System.DateTime";
    }
}
